home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / xmasspak / flat / flat.doc next >
Encoding:
Text File  |  1995-07-02  |  2.3 KB  |  66 lines

  1.                          Documentation to FLAT-model
  2.                        ───────────────────────────────
  3.  
  4. We all know that the Rral-mode of the Intel'80xxx serious only allows a 
  5. memory-allocation of max. 1Mbyte.
  6. If we want to use more memory we had to switch into the Protected-mode.
  7. In that mode we are able to use the whole installed memory of the PC, but well
  8. the Protected-mode is organized in a totally other way as the Real-mode, also
  9. the CPU waste 10% more of the time to organize that Protected-mode compared
  10. to the Real-mode.
  11. Well, some time ago some fine hackers find a way to use the whole memory also
  12. in the Real-mode. The trick is very simple, just swith into the Protected-mode
  13. turn all segment-register to a limit of 4Gbyte and switch back to the Real-
  14. mode without resetting the processor and well, we can know reach the whole
  15. memory from the Real-mode.
  16.  
  17. In FLAT.INC i followed that way and included some routines to work with this
  18. model.
  19. The thing is easy, i switch into the Protected-mode, there i change the
  20. segment-register ES,FS,GS to a limit of 4Gbyte and switch back to Real-mode.
  21.  
  22. Mostly i use the GS-register for getting into the memroy up to 1Mbyte.
  23. But be careful you've to keep some things in mind.
  24. You can't set the GS-register to 1Mbyte, you have to do it with the offset.
  25.  
  26. Example: We want to write a 0 into the 1Mbyte ram-position of the PC.
  27.  
  28.       xor ax,ax     ; ax=0
  29.       mov gs,ax     ; gs=0
  30.  
  31.       -now the GS-register is pointed to the beginn of the PC-ram, now we've
  32.        to add a 1Mbyte offset to it
  33.  
  34.       mov esi,1024*1024
  35.  
  36.       mov gs:esi,0    
  37.  
  38.       -now we've written a 0 at the 1Mbyte ram-position.
  39.  
  40. If you using a HIMEM-driver you've to add a free block of memory to the
  41. offset, coz the HIMEM-driver loads programms into the HMA, that's the 1st
  42. 64Kbyte after the 1Mbyte-ram.
  43. So we have to change out routine in following way:
  44.  
  45.       xor ax,ax
  46.       mov gs,ax
  47.  
  48.       mov esi,1024*1024+65535
  49.  
  50.       mov gs:esi,0
  51.  
  52.  
  53. that's it.......
  54.  
  55. Well, the routine in the FLAT.INC file always have those 1024*1024+65525
  56. addition included.
  57. So each time when you read or write to the memory about 1Mbyte over the GS-
  58. register you alwas have those value added to the offset.
  59. That means that when you give to the routine the offset 0 it means in real
  60. 1024*1024+65535.....
  61.  
  62. Totally simple.......
  63.  
  64.  
  65.    
  66.